home *** CD-ROM | disk | FTP | other *** search
/ Floppyshop 2 / Floppyshop - 2.zip / Floppyshop - 2.iso / art&graf.ix / art-0015 / flicker / clock.asm < prev    next >
Assembly Source File  |  1997-04-16  |  2KB  |  97 lines

  1.  
  2.     public _mouse_y
  3.     public _pscreen
  4.     public _zoom_flag
  5.  
  6.  
  7.     ; time_peek()
  8.     ;    catch a look at 200 Hz system clock
  9.     public _time_peek
  10. _time_peek
  11.     pea        timer
  12.     move.w    #38,-(sp)
  13.     trap    #14
  14.     addq    #6,sp
  15.     rts
  16.  
  17. timer     ; return system 200hz clock in d0 from super mode
  18.     move.l    $4ba,d0
  19.     rts
  20.  
  21.  
  22.     ; beam_peek()
  23.     ;    find out what word the video beam is on
  24.     ;    it's between $f8000 and $ffd00 if you don't setscreen ...
  25.     public _beam_peek
  26. _beam_peek
  27.     pea        beamer
  28.     move.w    #38,-(sp)
  29.     trap     #14
  30.     addq    #6,sp
  31.     rts
  32.  
  33. beamer    ; what gets done in supervisor - look at hardware beam registers
  34.     move.l    #$ff8205,a0
  35.     move.l    #0,d0
  36.     move.b    (a0),d0
  37.     asl.l    #8,d0
  38.     adda.w    #2,a0
  39.     move.b    (a0),d0
  40.     asl.l    #8,d0
  41.     adda.w    #2,a0
  42.     move.b    (a0),d0
  43.     rts
  44.  
  45.  
  46.     ; wait_out_beam()
  47.     ;    wait until it looks like not in danger of intersecting beam
  48.     ;    with cursor position
  49.     public _wait_out_beam
  50. _wait_out_beam
  51.     tst.w    _zoom_flag
  52.     bne        waited            ; don't need to skip beam when in zoom
  53.     move.l    _pscreen,d1
  54.     add.l    #32000,d1        ; find end of screen
  55.     bsr        _beam_peek        ; check the beam
  56.     cmp.l    d0,d1
  57.     beq        waited            ; if in 1st 1/2 of vblank return now
  58.     move.w    _mouse_y,d1
  59.     move.l    _pscreen,a1
  60.     lsl.w    #5,d1
  61.     add.w    d1,a1
  62.     lsl.w    #2,d1
  63.     add.w    d1,a1
  64.     move.l    a1,d1
  65.     move.l    d1,d2            ; a1=d1=d2 = pscreen + 160 * mouse_y
  66.     sub.l    #28*160,d1        ; lower bound of beam address to wait for
  67.     add.l    #8*160,d2        ; upper bound of beam address to wait for
  68. waitloop    cmp.l    d1,d0    
  69.     ble        waited
  70.     cmp.l    d2,d0
  71.     bge        waited
  72.     bsr        _beam_peek
  73.     bra     waitloop
  74. waited    rts
  75.  
  76.  
  77.     ;skip_beam()
  78.     ;    wait to do copy screen so that avoid beam
  79.     ;    copy screen takes less than 1/50th second
  80.     ;    color beam time 1/70th second
  81.     ;    so beam outruns copy a bit
  82.     ;    wait for beam to be in top 3/4 of screen...
  83.     public _skip_beam
  84. _skip_beam
  85.     move.l    _pscreen,d1
  86.     move.l    d1,d2
  87.     add.l    #1*160,d1        ; lower bound of beam to wait for
  88.     add.l    #150*160,d2        ; upper bound of beam to wait for
  89. skiploop    
  90.     bsr        _beam_peek
  91.     cmp.l    d1,d0    
  92.     blt        skiploop
  93.     cmp.l    d2,d0
  94.     bgt        skiploop
  95.     rts
  96.  
  97.